/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Windows;

import Data.MyClipBoard;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JTextArea;
import javax.swing.event.PopupMenuListener;

/**
 *
 * @author DavidUser
 */
public class PopUpPaste extends JPopupMenu{
        
    public PopUpPaste(final JTextArea input, final JTextArea param, final JTextArea output){
        JMenuItem anItem;
        ActionListener menuListener = new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                MyClipBoard clip = new MyClipBoard();
                try {
                    input.setText(clip.GetClipBoard());
                    param.setText("");
                    output.setText("");
                } catch (IOException ex) {
                    Logger.getLogger(XMLGenerator.class.getName()).log(Level.SEVERE, null, ex);
                };
            }
        };
        
        anItem = new JMenuItem("Paste");
        add(anItem);
        anItem.addActionListener(menuListener);
    }
   
}
